<template>
  <div>
    <button v-for="(item, index) in title" :key="index" @click="fn(index)">
      {{ item }}
    </button>
    <div class="box"></div>
    <keep-alive>
      <router-view></router-view>
    </keep-alive>
  </div>
</template>

<script>
export default {
  data() {
    return {
      num: 0,
      title: ["企业数据", "服务器数据", "省份数据"],
    };
  },
  mounted() {},
  methods: {
    fn(num) {
      if (num == 0 && this.num != 0) {
        this.num = 0;
        this.$router.push("/home/state/statecom");
      } else if (num == 1 && this.num != 1) {
        this.num = 1;
        this.$router.push("/home/state/web");
      } else if (num == 2 && this.num != 2) {
        this.num = 2;
        this.$router.push("/home/state/province");
      }
    },
  },
};
</script>
<style lang='less' scoped>
</style>